package cn.iocoder.yudao.module.product.dal.mysql.resourcecategory;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.product.dal.dataobject.resourcecategory.ResourceCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.product.controller.admin.resourcecategory.vo.*;

/**
 * 产品资源分享分类 Mapper
 *
 * @author 阿杰
 */
@Mapper
public interface ResourceCategoryMapper extends BaseMapperX<ResourceCategoryDO> {

    default PageResult<ResourceCategoryDO> selectPage(ResourceCategoryPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ResourceCategoryDO>()
                .eqIfPresent(ResourceCategoryDO::getAncestors, reqVO.getAncestors())
                .eqIfPresent(ResourceCategoryDO::getProductResourceCategoryId, reqVO.getProductResourceCategoryId())
                .likeIfPresent(ResourceCategoryDO::getProductResourceCategoryName, reqVO.getProductResourceCategoryName())
                .eqIfPresent(ResourceCategoryDO::getDelFlag, reqVO.getDelFlag())
                .eqIfPresent(ResourceCategoryDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ResourceCategoryDO::getParams, reqVO.getParams())
                .likeIfPresent(ResourceCategoryDO::getParentName, reqVO.getParentName())
                .eqIfPresent(ResourceCategoryDO::getParent, reqVO.getParent())
                .eqIfPresent(ResourceCategoryDO::getSearchValue, reqVO.getSearchValue())
                .eqIfPresent(ResourceCategoryDO::getPic, reqVO.getPic())
                .eqIfPresent(ResourceCategoryDO::getShowPic, reqVO.getShowPic())
                .eqIfPresent(ResourceCategoryDO::getShowFront, reqVO.getShowFront())
                .eqIfPresent(ResourceCategoryDO::getSort, reqVO.getSort())
                .eqIfPresent(ResourceCategoryDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ResourceCategoryDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(ResourceCategoryDO::getCreateBy, reqVO.getCreateBy())
                .eqIfPresent(ResourceCategoryDO::getUpdateBy, reqVO.getUpdateBy())
                .eqIfPresent(ResourceCategoryDO::getRemark, reqVO.getRemark())
                .orderByDesc(ResourceCategoryDO::getId));
    }

}